package com.itheima.web.controller;

import com.itheima.pojo.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-14 09:34
 * @description
 */
@Controller
@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService accountService; //springmvc.xml 扫描web包,不扫描service包,避免耦合,用spring框架的bean.xml


    @RequestMapping("/add")
    public String add(Account account){
        System.out.println("正在请求controller层的代码!!!"+account);

        //调用业务层的方法
        accountService.add(account);
        return "account/success";
    }
}
